package com.twu.biblioteca;

import sun.misc.Regexp;

/**
 * Created with IntelliJ IDEA.
 * User: Hugo
 * Date: 01/02/13
 * Time: 22:32
 * To change this template use File | Settings | File Templates.
 */
public class User {
    private String Username;
    private String Password;
    private String Name;
    private String Email;
    private String PhoneNumber;

    public User(String UserName, String Password, String Name, String Email, String PhoneNumber)
    {
        //note - add regex checks to other fields in the future
        if(!UserName.matches("[1-9]{3}[-][1-9]{4}"))
        {
            throw new IllegalArgumentException("Username must fit the pattern xxx-xxxx where x is a number between 1 and 9");
        }
        this.Username = UserName;
        this.Password = Password; //should get hashed
        this.Name = Name;
        this.Email = Email;
        this.PhoneNumber = PhoneNumber;
    }

    public boolean IsEqual(String Username, String Password)
    {
        if(this.GetUsername().equals(Username))
        {
            if(this.GetPassword().equals(Password))
            {
                return true;
            }
        }
        return false;
    }

    public String GetUsername()
    {
        return this.Username;
    }
    private String GetPassword()
    {
        return this.Password;
    }
    public String GetName()
    {
        return this.Name;
    }
    public String GetEmail()
    {
        return this.Email;
    }
    public String GetPhoneNumber()
    {
        return this.PhoneNumber;
    }


}
